package com.brillilab.common.constant;

import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 * @author linzhikang
 * @description
 * @date 2019-09-20 13:37
 */
@Getter
public enum AccessUrlEnum {
    //todo 修改url地址
    EXPERIMENT_ACCESS(3, "experiment_access", "/api/home/test1"),
    METHOD_ACCESS(4, "method_access", "/api/home/test2"),
    MATERIEL_ACCESS(5, "materiel_access", "/api/home/test3"),
    WORK_PLAN_ACCESS(6, "work_plan_access", "/api/home/test4");

    private Integer type;
    private String key;
    private String url;

    private static final Map<String, AccessUrlEnum> ACCESS_URL_MAP = new HashMap<>();

    static {
        for (AccessUrlEnum s : AccessUrlEnum.values()) {
            ACCESS_URL_MAP.put(s.getUrl(), s);
        }
    }

    AccessUrlEnum(Integer type, String key, String url) {
        this.type = type;
        this.key = key;
        this.url = url;
    }

    public static AccessUrlEnum getAccess(String url) {
        return ACCESS_URL_MAP.get(url);
    }
}
